﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<Brjostagjof_H4.Models.EntryListModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">Brjóstagjöf.is | Greinar</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">


    <h3>Greinar</h3>
    <table id="main-table">
        <tr>

            <td id="main-table-left">
                <span class="new-button"><%: Html.ActionLink("Ný grein", "CreateEntry", "Admin") %></span>
                <div id="entries-edit" class="user-edit-list-container">
                    <% if (Model.Count() > 0)
                        { %>
                        <table>
                            <thead>
                                <tr>
                                    <th class="user-edit-title">Titill</th>
                                    <th>Höfundur</th>
                                    <th>Dagsetning</th>
                                    <th></th>
                                </tr>
			                </thead>
			                <tbody>
				                <% foreach (var entry in Model)
                        { %>
				                <tr>
					                <td><%: Html.ActionLink(entry.title, "EditEntry", new { id = entry.ID })%></td>
					                <td><%: entry.author%></td>
					                <td><%: entry.posted%></td>
                                    <td><%: Html.ActionLink("Breyta", "EditEntry", new { id = entry.ID })%></td>
				                </tr>
				                <% } %>
			                </tbody>
                        </table>
                        <% } %>
                        <% else
                        { %>
                        <p>Engar færslur fundust.</p>
                        <% } %>
                </div>
            </td>

            <td id="main-table-right">
                <div class="options">
                    <% if (User.IsInRole("Administrators")){Html.RenderPartial("~/Views/Home/ProfileAdminMenu.ascx", "Model");} %>
                    <% else if (User.IsInRole("Professionals")) { Html.RenderPartial("~/Views/Home/ProfileProMenu.ascx", "Model"); } %>
                    <% else { Html.RenderPartial("~/Views/Home/ProfileMenu.ascx", "Model"); } %>
                </div>
            </td>

        </tr>
    </table>

</asp:Content>